<template>
  <div>
    <el-carousel
      :interval="4000"
      class="banner-carousel"
      type="card"
    >
      <el-carousel-item
        v-for="(item,index) in banners"
        :key="index"
      >
        <img
          :src="$utils.genImgUrl(item.imageUrl, 1000, 400)"
          class="banner-img"
        >
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script>
import { getBanner } from "@/api"
export default {
  async created() {
    const { banners } = await getBanner()
    this.banners = banners
    console.log(this.banners)
  },
  data() {
    return {
      banners: []
    }
  }
}
</script>
<style lang="scss" scoped>
.banner-carousel {
  /deep/.el-carousel__container {
    height: 200px;
  }
  .banner-img {
    width: 100%;
    border-radius: 4px;
  }
}
</style>